/ Assembly List / LJCDBClientLib / ObjectManager`2 / Add

Namespace - LJCDBClientLib


Parameters
dataObject - The record object.
propertyNames - The included column property names.

Returns

The object with the DB assigned key values.

Syntax

C#
public TData Add(TData dataObject, List<String> propertyNames = null)

Adds a record to the database. (E)

Example

C#
// Adds a Person record.
private static void Add(ObjectManager<Person, Persons> personManager)
{
  // The inserted columns must not include the DB assigned columns.
  Person dataObject = new Person()
  {
    Name = "TestName",
    PrincipleFlag = false
  };

  // Insert record and return the database assigned values.
  Person resultPerson = personManager.Add(dataObject);
  if (resultPerson != null)
  {
    dataObject.ID = resultPerson.ID;
  }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.